import Vue from 'vue'
import Router from 'vue-router'
//import p_error from '@/pages/p_error'
const p_error = resolve => require(['@/pages/p_error'], resolve)
//import p_weather from '@/pages/p_weather'
const p_weather = resolve => require(['@/pages/p_weather'], resolve)
//import p_news from '@/pages/p_news'
const p_news = resolve => require(['@/pages/p_news'], resolve)
//import p_ask from '@/pages/p_ask'
const p_ask = resolve => require(['@/pages/p_ask'], resolve)
//import p_article from '@/pages/p_article'
const p_article = resolve => require(['@/pages/p_article'], resolve)
//import p_setting from '@/pages/p_setting'
const p_setting = resolve => require(['@/pages/p_setting'], resolve)
//import p_spots from '@/pages/p_spots'
const p_spots = resolve => require(['@/pages/p_spots'], resolve)
//import p_spots_list from '@/pages/p_spots_list'
const p_spots_list = resolve => require(['@/pages/p_spots_list'], resolve)
//import p_spots_detail from '@/pages/p_spots_detail'
const p_spots_detail = resolve => require(['@/pages/p_spots_detail'], resolve)
//import p_spots_image from '@/pages/p_spots_image'
const p_spots_image = resolve => require(['@/pages/p_spots_image'], resolve)

Vue.use(Router)

export default new Router({
	mode: 'history',
	routes: [
		{
			path: '*',
			component: p_error
		},
		{
			path: '/',
			redirect: '/news'
		},
	    {
	    	path: '/setting',
	    	name: 'setting',
	    	component: p_setting
	    },
	    {
	    	path: '/spots',
	    	name: 'spots',
	    	component: p_spots,
	    	children: [
	    		{
	    			path: 'list',
	    			name: 'spots-list',
	    			component: p_spots_list,
	    			alias: ''
	    		},
	    		{
	    			path: 'detail',
	    			name: 'spots-detail',
	    			component: p_spots_detail
	    		},
	    		{
	    			path: 'image',
	    			name: 'spots-image',
	    			component: p_spots_image
	    		}
	    	]
	    },
	    {
			path: '/weather',
			name: 'weather',
			component: p_weather
		},
		{
			path: '/news',
			name: 'news',
			component: p_news
		},
		{
			path: '/ask',
			name: 'ask',
			component: p_ask
		},
	    {
			path: '/article',
			name: 'article',
			component: p_article
		}
	],
	linkActiveClass: '',
	scrollBehavior (to, from, savedPosition) {
		return { x: 0, y: 0 }
	}
})
